﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Test.aspx.cs" Inherits="iMall.AtoZ.Test" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="stylesheet" href="Scripts/plupload/js/jquery.plupload.queue/css/jquery.plupload.queue.css"
        type="text/css" media="screen" />
    <script type="text/javascript" src="Scripts/plupload/js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
    <script type="text/javascript" src="Scripts/plupload/js/plupload.js"></script>
    <script type="text/javascript" src="Scripts/plupload/js/plupload.flash.js"></script>
    <script type="text/javascript" src="Scripts/zclip/jquery.zclip.min.js"></script>
    <script type="text/javascript" src="Scripts/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js"></script>
    <script type="text/javascript" src="Scripts/plupload/js/i18n/cn.js"></script>
    <script type="text/javascript">
        if (document.domain == 'tuan.ilongshe.com') {
            window.webUrl = 'http://www.ilongshe.com/tuan/';
        }
        var webUrl = "<%=WebURL %>";
        var localUrl = "<%=LocalURL %>";

        function newGuid() {
            var guid = "";
            for (var i = 1; i <= 32; i++) {
                var n = Math.floor(Math.random() * 16.0).toString(16);
                guid += n;
                if ((i == 8) || (i == 12) || (i == 16) || (i == 20))
                    guid += "-";
            }
            return guid;
        }

        function getCurrentDirectory() {
            var locHref = location.href;
            var locArray = locHref.split("/");
            delete locArray[locArray.length - 1];
            var dirTxt = locArray.join("/");
            return dirTxt;
        }

        var bn = newGuid();
        $(function () {
            // 初始化Flash上传插件
            $("#flash_uploader").pluploadQueue({
                runtimes: 'flash', 	//使用Flash插件
                url: '/Scripts/plupload/upload.aspx', 	//服务器端响应页面
                max_file_size: '1000mb', //最大文件限制
                chunk_size: '1mb', 	//一次上传数据大小
                unique_names: false, 	//是否自动生成唯一名称
                filters: [				//文件类型限制
				{title: "Excel（xls,xlsx)", extensions: "xls,xlsx" }
			],
                // 缩放图片
                //resize: { width: 320, height: 240, quality: 80 },

                // SWF文件位置
                flash_swf_url: '/Scripts/plupload/js/plupload.flash.swf',

                init: {
                    FileUploaded: function (up, file, info) {
                        var fileInfo = 'data=' + '{"name":"' + file.name + '","path":"' + info.response + '","size":"' + file.size + '","batchNum":"' + bn + '"}';
                        ImpAccessData(file.name, info.response);
                        if (up.total.queued == 0) {
                            alert('所有文件上传成功');
                        }
                    },

                    Error: function (up, args) {
                        //发生错误
                        if (args.file) {
                            alert('[出错啦] 文件:' + args.file);
                        } else {
                            alert('[出错啦]' + args);
                        }
                    }
                }
            });
        });

        function ImpAccessData(name, path) {
            $("#result").append(name + "：" + path + '<br/>');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <div id="flash_uploader" style="width: 460px; height: 320px;">
            您没有安装Flash！</div>
        <div id="result">
        </div>
    </div>
</asp:Content>
